﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Cofe.Core;
using Cofe.Core.Filter;
using Cofe.Core.Implements;
using Cofe.Data.Utils.ThirdParty;
namespace Cofe.Data.Filter
{
    [Export(typeof(ICofeService))]
    [ServicePriority(ServicePriorityAttribute.DefaultPriority_COFEDB)]
    public class TagsEntryFilterExpression :
        IEntryFilterExpression<TagsEntryFilter>
    {
        public Expression<Func<CofeSystemInfo, bool>> GetQueryExpression(TagsEntryFilter entryFilter, IOptionFilter[] options)
        {
            return (e) => e.DatabaseEntry.HashTags.Any(ht => ht.TagName.Equals(entryFilter.Value));            
        }
    }
}
